import NetWork from "./NetWork";

export default class NewWorkManager {
    private static _instance: NewWorkManager = null;

    private _netWork: NetWork = null;

    private constructor() {
        this._netWork = new NetWork();
    }

    public static get instance(): NewWorkManager {
        if (this._instance === null) {
            this._instance = new this();
        }
        return this._instance;
    }

    public connectServer() {
        // this._netWork.connect("ws://echo.websocket.org"); 
        this._netWork.connect("ws://82.157.123.54:9010/ajaxchattest");
    }

    public send(data: string) {
        this._netWork.send(data);
    }

    public isSocketState() {
        return false;
    }

    public close() {
        this._netWork.close();
    }
}